﻿using OA.Core;
using OA.Model.MyAttribute;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
//using System.Web.DynamicData;

namespace OA.Model
{
    public enum MyDelegationStatus
    {
        [Description("有效")]
        Text = 1,
        [Description("已取消")]
        Number = 2,
    }

    //[TableName("工作委托表")]
    [Table("MyDelegation")]
    public class MyDelegation : BaseInfo
    {
        /// <summary>
        /// 1正常 2 已取消
        /// </summary>
        [Display(Name = "状态")]
        [Description("-1 被删除 0 草稿  1 未审核 2:正在审核中 4 审核不通过 8 已审核")]
        public int Status { get; set; }

        [NotMapped]
        public string StatusName { get { return MyEnum.GetEnumNameByValue(this.Status, typeof(MyDelegationStatus)); } }

        [MaxLength(10)]
       // [Index("FromEmpID")]        
        public string FromEmpID { get; set; }

        [MaxLength(20)]
        public string FromEmpName { get; set; }

        [MaxLength(10)]
       // [Index("ToEmpID")]
        [Display(Name = "委托人")]
        public string ToEmpID { get; set; }

        [MaxLength(20)]
        public string ToEmpName { get; set; }


        public int ToDeparentID { get; set; }


        public int ToPositionID { get; set; }

        /// <summary>
        /// 开始时间 2018-12-18 10:00:00
        /// </summary>
        [MaxLength(20)]
        [Tag(TagEnum.DateTime, "required", "开始时间",10,20)]
        public string StartTime { get; set; }

        [MaxLength(20)]
        [Tag(TagEnum.DateTime, "required", "开始时间", 10, 20)]
        public string EndTime { get; set; }

        [Display(Name = "委托单据")]
        [Tag(TagEnum.Select, "required", "委托单据", null)]
        public int CustomFormID { get; set; }

        [MaxLength(10)]
        public string CustomFormName { get; set; }

        public DateTime? CancelDateTime { get; set; }

    }

}
